﻿using Npgsql;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper;

namespace ConsoleApp
{
    public class NpgsqlDB
    {
         public static void Insert()
        {
            string strConn = "host=127.0.0.1;port=5432;database=Test;password=123456;user id=postgres";
            var conn = new NpgsqlConnection(strConn);


            var cmd = conn.CreateCommand();
            var para = cmd.CreateParameter();


            


            try
            {
                int res = Dapper.SqlMapper.Execute(conn, "insert into Person(id,name,age)values(@id,@name,@age)", new { id = "100", name = "xiaoqiang", age = 20 });
            }
            catch (Exception ex)
            {
                Dapper.DynamicParameters dynPara = new Dapper.DynamicParameters();
                
            }
            
        }


        public static void Query()
        {
            string strConn = "host=127.0.0.1;port=5432;database=Test;password=123456;user id=postgres";
            var conn = new NpgsqlConnection(strConn);
            
        }
    }
}
